function cnsubstr($str,$strlen=10) { 

if(empty($str)||!is_numeric($strlen)){ 
return false; 
} 
if(strlen($str)<=$strlen){ 
return $str; 
} 

//得到第$length个字符 并判断是否为非中文 若为非中文 
//直接返回$length长的字符串 
$last_word_needed=substr($str,$strlen-1,1); 
if(!ord($last_word_needed)>128){ 
$needed_sub_sentence=substr($str,0,$strlen); 
return $needed_sub_sentence; 
}else{ 
for($i=0;$i<$strlen;$i++){ 
if(ord($str[$i])>128){ 
$i++; 
} 
}//end of for 
$needed_sub_sentence=substr($str,0,$i); 
return $needed_sub_sentence; 
} 
} 

    FactoryConnection::closeConnection($Con);